

****************** This master program runs all programs in the correct order to generate the results in the paper and the appendix ******************


clear all
set more off, permanently

* Set local directory
global localdir "J:\Workdata\704351\Amalie\Networks\JOP Publication Files" 


********************* Output using Danish register data and survey data (run on server at Statistics Denmark *********************


****** Programs to generate data 

// Run programs "Get register data.sas" and "Get survey data.sas" in SAS to get register data and survey from raw data location on the Statistics Denmark server

do "$localdir\Code\Generate register data variables.do"

do "$localdir\Code\Generate survey data variables.do"

do "$localdir\Code\Generate education and workplace links data.do"

do "$localdir\Code\Generate fixed effects data for regressions.do"

do "$localdir\Code\Generate networks data pt 1.do"

// Go to R to run first part of "Create adjacency matrix.R"

do "$localdir\Code\Generate networks data pt 2.do"

do "$localdir\Code\Generate i-j-k networks data pt 1.do"

// Go to R to run second part of "Create adjacency matrix.R"

do "$localdir\Code\Generate i-j-k networks data pt 2.do"

do "$localdir\Code\Generate placebo networks data.do"



****** Programs to run the analysis and generate output 

* Main tables 

do "$localdir\Code\Table2.do"

do "$localdir\Code\Table4.do"

do "$localdir\Code\Table1.do"

do "$localdir\Code\Table3_PanelA.do"

do "$localdir\Code\Table3_PanelB.do"

do "$localdir\Code\Table3_PanelC.do"

do "$localdir\Code\Table3_PanelD.do"

do "$localdir\Code\Table5.do"

* Appendix tables 

do "$localdir\Code\TableA2.do"

do "$localdir\Code\TableA3.do"

do "$localdir\Code\TableA4.do"

do "$localdir\Code\TableA5.do"

// Table A6 is run as part of "Table3_PanelD.do"

do "$localdir\Code\TableA8_PanelA.do"

do "$localdir\Code\TableA8_PanelB.do"

do "$localdir\Code\TableA9.do"

do "$localdir\Code\TableA10.do"

do "$localdir\Code\TableA7_PanelA.do"

do "$localdir\Code\TableA7_PanelB.do"

do "$localdir\Code\TableA7_PanelC.do"

do "$localdir\Code\TableA7_PanelD.do"

do "$localdir\Code\TableA7_PanelE.do"

do "$localdir\Code\TableA7_PanelF.do"

do "$localdir\Code\TableA7_PanelG.do"




********************* Output using only survey data  *********************

* Main figures

do "$localdir\Code\Figure1.do"

do "$localdir\Code\Figure2_Figure5.do"





